package second;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Dynamic extends HttpServlet{
	@Override
	protected void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{
		request.setCharacterEncoding("gb2312");
		String usrName=request.getParameter("userName");
		String ip=request.getRemoteAddr();
		response.setContentType("text/html;charset=gbk");
		PrintWriter out=response.getWriter();
		out.println("<html>");
		out.println("<head>");
		out.println("<title>生成动态网页</title>");
		out.println("</head>");
		out.println("<body>");
		out.println("<p>");
		out.println("欢迎");
		out.println("<strong>");
		out.println(usrName);
		out.println("</strong>");
		out.println("来自");
		out.println("<strong>");
		out.println(ip);
		out.println("</strong>");
		out.println("的朋友");
		out.println("</p>");
		out.println("</body>");
		out.println("</html>");
	}
	@Override
	protected void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException{
		response.setContentType("text/html;charset=gbk");
		PrintWriter out=response.getWriter();
		out.println("<html>");
		out.println("<head>");
		out.println("<title>生成动态网页</title>");
		out.println("</head>");
		out.println("<body>");
		out.println("<p>");
		out.println("非法的访问请求");
		out.println("</p>");
		out.println("</body>");
		out.println("</html>");
	}
}
